// Copyright 2023 Srhino Co., Ltd. All rights reserved.

package main

import (
	"context"
	"git.ouryun.cn/lzj1/grpc-bidirectional-stream/pkg/services/v2"
	"log"
	"ouryun.com/web-demov2/server/pkg/webserver"
	"ouryun.com/web-demov2/utils"
)

func main() {
	wait := make(chan struct{})
	var app *webserver.Server
	ctx := context.Background()
	// 启动web服务
	app = webserver.NewServer("127.0.0.1", 8080, nil)
	log.Println("start web server")
	var server = v2.NewGrpcServer("127.0.0.1:10086", "", ctx, app.Callback)
	app.SetGs(server)
	go func() {
		err := server.Start()
		if err != nil {
			utils.Logger.Error(err)
		}
	}()
	err := app.Start()
	if err != nil {
		utils.Logger.Error(err)
	}

	<-wait
}
